qui {
	local cnt=0
	forvalues truncation=$truncation_list {
		local cnt=`cnt'+1
	}
	capture program drop ccn_het2_LL
	local count=0
	foreach lhs in $LHSlist { 
		local controls="${CONTROLlist_`lhs'_wage}"
		local subsample = "$subsample"
		foreach rhs in $RHSlist { 
			foreach robust in $robust_list {
				forvalues K=$K_list {
					matrix actual_estimates_mat = J(`cnt',14,-9)
					local rowcounter = 0
					forvalues truncation=$truncation_list {
						noisily display "LHS=`lhs', RHS=`rhs', SE=`robust', K=`K', $S_DATE, $S_TIME, `truncation'"
						local rowcounter = `rowcounter'+1
						use "$datapath/003_cluster_`subsample'_`lhs'.dta", clear
						qui tab X_`K', generate(dumX_`K'_)
						gen A=afqt_mom
						gen W=wage_mom_r
						gen WA=W*A
					
						qui ccn_het2_LL symmetric `K' `rhs' `lhs' `robust' "`controls'" het_tobit `truncation'
						matrix actual_estimates_mat[`rowcounter',1] = r(BETA)
						matrix actual_estimates_mat[`rowcounter',2] = r(SE)		
						matrix actual_estimates_mat[`rowcounter',3] = r(BETA_A)
						matrix actual_estimates_mat[`rowcounter',4] = r(SE_A)		
						matrix actual_estimates_mat[`rowcounter',5] = r(BETA_L)
						matrix actual_estimates_mat[`rowcounter',6] = r(SE_L)		
						matrix actual_estimates_mat[`rowcounter',7] = r(BETA_AL)
						matrix actual_estimates_mat[`rowcounter',8] = r(SE_AL)		
						matrix actual_estimates_mat[`rowcounter',9] = r(BETA_W)
						matrix actual_estimates_mat[`rowcounter',10] = r(SE_W)		
						matrix actual_estimates_mat[`rowcounter',11] = r(BETA_WL)
						matrix actual_estimates_mat[`rowcounter',12] = r(SE_WL)		
						matrix actual_estimates_mat[`rowcounter',13] = r(ESAMP)	
						matrix actual_estimates_mat[`rowcounter',14] = `truncation'	
					}
					mat colnames actual_estimates_mat = b_HetSymm se_HetSymm bA_HetSymm seA_HetSymm bL_HetSymm seL_HetSymm ///
					bAL_HetSymm seAL_HetSymm bW_HetSymm seW_HetSymm bWL_HetSymm seWL_HetSymm Neff_HetSymm truncation
					clear

					qui svmat actual_estimates_mat, names(col)
					replace b_HetSymm=b_HetSymm*100
					replace se_HetSymm=se_HetSymm*100
					replace bA_HetSymm=bA_HetSymm*100
					replace seA_HetSymm=seA_HetSymm*100
					replace bL_HetSymm=bL_HetSymm*1000
					replace seL_HetSymm=seL_HetSymm*1000
					replace bAL_HetSymm=bAL_HetSymm*1000
					replace seAL_HetSymm=seAL_HetSymm*1000
					replace bW_HetSymm=bW_HetSymm*100
					replace seW_HetSymm=seW_HetSymm*100
					replace bWL_HetSymm=bWL_HetSymm*1000
					replace seWL_HetSymm=seWL_HetSymm*1000
					
					gen LHS="`lhs'"
					gen RHS="`rhs'"
					gen Kcluster=`K'
					gen Robust="`robust'"
					save "$datapath/004_het2_results_`subsample'_`lhs'_`robust'_K`K'_LL.dta", replace
				}
			}
		}
	}			
}

